package http_error

type ResData map[string]interface{}

type HttpError struct {
	ErrorCode int    `json:"code" example:"400"`
	ErrorMsg  string `json:"msg" example:"status bad request"`
}

func DefaultError(msg string) HttpError {
	return HttpError{
		ErrorCode: 500,
		ErrorMsg:  msg,
	}
}

var (
	MissingParametersError = HttpError{
		ErrorCode: 5001,
		ErrorMsg:  "缺少参数",
	}

	WrongPage = HttpError{
		ErrorCode: 5002,
		ErrorMsg:  "wrong page",
	}

	UploadFileIsTooLarge = HttpError{
		ErrorCode: 5003,
		ErrorMsg:  "uploaded file is too large",
	}

	UploadFileErr = HttpError{
		ErrorCode: 5004,
		ErrorMsg:  "uploaded file error",
	}

	EsError = HttpError{
		ErrorCode: 5005,
		ErrorMsg:  "Error creating the  es client",
	}

	NoType = HttpError{
		ErrorCode: 600,
		ErrorMsg:  "不支持的类型",
	}

	SignErr = HttpError{
		ErrorCode: 601,
		ErrorMsg:  "签名错误",
	}

	MsmNetworkErr = HttpError{
		ErrorCode: 602,
		ErrorMsg:  "网络错误",
	}

	NoRedisKey = HttpError{
		ErrorCode: 604,
		ErrorMsg:  "没有redis key",
	}

	FrequentOperations = HttpError{
		ErrorCode: 605,
		ErrorMsg:  "操作太频繁，请稍后再试",
	}

	NoAESKey = HttpError{
		ErrorCode: 606,
		ErrorMsg:  "没有aes key",
	}

	NotAllowed = HttpError{
		ErrorCode: 607,
		ErrorMsg:  "非法请求",
	}
)
